﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;

namespace Client
{
    class ClsSocket
    {
        ClsClientMonitor klientMonitor;
        NetworkStream stream;

        public ClsSocket(ClsClientMonitor klientMonitor, NetworkStream stream)
        {
            this.klientMonitor = klientMonitor;
            this.stream = stream;
        }

        // Lytter efter besked
        public void StartForbindelse()
        {
            klientMonitor.TilføjKlient(stream);

            ClsServerHandler Client = new ClsServerHandler(stream, klientMonitor);
            Thread clientTråd1 = new Thread(Client.Læser);
            clientTråd1.IsBackground = true;
            clientTråd1.Start();
        }
    }
}
